package com.example.parttimejob.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.parttimejob.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    //根据id查询真名
    @Select("select real_name from part_time_job.users where user_id=#{userId}")
    String selectRealByUserId(Integer userId);


    //根据用户名查询
    @Select("select * from part_time_job.users where username=#{Username}")
    User selectByUsername(String Username);
    //注册
    @Insert("insert into part_time_job.users(username,passwd,account_status) values (#{Username},#{passwd},#{status})")
    void registUser(String Username, String passwd,String status);

    //判断用户是否实名
    @Select("select account_status from part_time_job.users where user_id=#{UserId}")
    String selectUserStatus(Integer UserId);

    //根据id查询密码
    @Select("select passwd from part_time_job.users where user_id=#{userId}")
    String selectPasswdById(Integer userId);


}
